package main

import (
	"github.com/nsf/termbox-go"
	"math/rand"
	"time"
)

var (
	//方块
	blockArr = [7][4]int{
		0: [4]int{0, 1, 2, 3}, //正方体
		1: [4]int{0, 1, 2, 3}, //长条竖
		2: [4]int{0, 1, 2, 3}, //s横
		3: [4]int{0, 1, 2, 3}, //z横
		4: [4]int{0, 1, 2, 3}, //l横
		5: [4]int{0, 1, 2, 3}, //J
		6: [4]int{0, 1, 2, 3}, //T
	}

	pieceColors = []termbox.Attribute{
		termbox.ColorBlack,
		termbox.ColorRed,
		termbox.ColorGreen,
		termbox.ColorYellow,
		termbox.ColorBlue,
		termbox.ColorMagenta,
		termbox.ColorCyan,
		termbox.ColorWhite,
	}
)

func random(max int) int {
	rand.Seed(time.Now().UnixNano())
	return rand.Intn(max)
}

func getPieceColor() termbox.Attribute {
	return pieceColors[random(len(pieceColors)-1)]
}
